package com.example.demo.Test;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.demo.Common.HttpClientUtil;

public class tes {
    public static void main(String[] args) {
        String url="http://api.map.baidu.com/weather/v1/?district_id=320508&data_type=all&ak=nrwhEQpeT8ZSqz6GOhPsxnT2WUD15idG";
        HttpClientUtil httpClientUtil=new HttpClientUtil();
        String s=httpClientUtil.doGet(url);
        JSONObject object1 = JSON.parseObject(s);
        JSONObject object2 = JSON.parseObject(object1.getString("result"));
        JSONObject object3 = JSON.parseObject(object2.getString("now"));
        System.out.println(object2.getString("now"));
        String temp=object3.getString("temp");
        String rh=object3.getString("rh");
        String wind_class=object3.getString("wind_class");
        String text=object3.getString("text");
        String wind_dir=object3.getString("wind_dir");
        String feels_like=object3.getString("feels_like");
        String uptime=object3.getString("uptime");
    }
}
